home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / FWString / SLTxtPar.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.9 KB  |  156 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLTxtPar.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef SLTXTPAR_H
  11. #define SLTXTPAR_H
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #ifndef FWCHARAC_H
  18. #include "FWCharac.h"
  19. #endif
  20.  
  21. #ifndef SLLOCALE_H
  22. #include "SLLocale.h"
  23. #endif
  24.  
  25. #ifndef FWODTYPS_H
  26. #include "FWODTyps.h"
  27. #endif
  28.  
  29. // Export or Import functions for CFM-68K [sfu]
  30.  
  31. #if defined(FW_ODFLIB_IMPORT)
  32. #pragma import on
  33. #elif defined(FW_ODFLIB)
  34. #pragma export on
  35. #endif
  36.  
  37.  
  38. FW_EXTERN_C_BEGIN
  39.  
  40. //========================================================================================
  41. //    Forward Declarations
  42. //========================================================================================
  43.  
  44. struct ODIText;
  45. struct FW_ODITextParams;
  46. struct FW_ODITextFunctions;
  47.  
  48. //========================================================================================
  49. //    Typedefs
  50. //========================================================================================
  51.  
  52. typedef void (*FW_TextParams_GetParamsProc)(ODIText *text, 
  53.                                             FW_ODITextParams* params, 
  54.                                             FW_PlatformError *error);
  55. typedef FW_Boolean (*FW_TextParams_IsCharacterStartProc)(ODIText *text, 
  56.                                             FW_BytePosition knownCharacterStartPosition, 
  57.                                             FW_BytePosition positionToCheck, 
  58.                                             FW_PlatformError *error);
  59. typedef FW_BytePosition (*FW_TextParams_GetBytePositionProc)(ODIText *text, 
  60.                                             FW_CharacterPosition position, 
  61.                                             FW_PlatformError *error);
  62. typedef void (*FW_TextParams_SetCapacityProc)(ODIText *text, 
  63.                                             long capacity, 
  64.                                             FW_Boolean deletePrevBuffer,
  65.                                             FW_PlatformError *error);
  66. typedef void (*FW_TextParams_SetLengthProc)(ODIText *text, 
  67.                                             long length, 
  68.                                             FW_PlatformError *error);
  69. typedef void (*FW_TextParams_SetLocaleProc)(ODIText *text, 
  70.                                             FW_Locale locale, 
  71.                                             FW_PlatformError *error);
  72.  
  73. //========================================================================================
  74. //    STRUCT FW_ODITextParams
  75. //========================================================================================
  76.  
  77. struct FW_ODITextParams
  78. {
  79.     char*                fTextStart;
  80.     FW_ByteCount        fTextByteLength;
  81.     FW_ByteCount        fTextByteCapacity;
  82.     FW_Locale            fTextLocale;
  83. };
  84.  
  85. //========================================================================================
  86. //    STRUCT FW_ODITextFunctions
  87. //========================================================================================
  88.  
  89. struct FW_ODITextFunctions
  90. {
  91.     FW_TextParams_GetParamsProc            fGetParams;
  92.     FW_TextParams_IsCharacterStartProc    fIsCharacter;
  93.     FW_TextParams_GetBytePositionProc    fGetBytePos;
  94.     FW_TextParams_SetCapacityProc        fSetCapacity;
  95.     FW_TextParams_SetLengthProc            fSetLength;
  96.     FW_TextParams_SetLocaleProc            fSetLocale;
  97. };
  98.  
  99. //========================================================================================
  100. //    ODIText Parameter Functions
  101. //========================================================================================
  102.  
  103. void FW_TextParams_GetParams(ODIText *text, 
  104.                             FW_ODITextParams* params, 
  105.                             FW_PlatformError *error);
  106.     // Given an ODIText, return the parameters for accessing the text data
  107.     
  108. FW_Boolean FW_TextParams_IsCharacterStart(ODIText *text, 
  109.                             FW_BytePosition knownCharacterStartPosition, 
  110.                             FW_BytePosition positionToCheck, 
  111.                             FW_PlatformError *error);
  112.     // Checks the byte at positionToCheck to see if it starts a character.
  113.     // For efficiency, pass into knownCharacterStartPosition the largest value less than
  114.     // positionToCheck for which it is known that a character starts at that position.
  115.     // If no such value is known, pass in 0 for knownCharacterPosition.
  116.  
  117. FW_BytePosition FW_TextParams_GetBytePosition(ODIText *text, 
  118.                             FW_CharacterPosition position, 
  119.                             FW_PlatformError *error);
  120.     // Given an ODIText and character position, return the byte position
  121.  
  122. void FW_TextParams_SetCapacity(ODIText *text, 
  123.                             long capacity, 
  124.                             FW_Boolean deletePrevBuffer,
  125.                             FW_ODITextParams* params, 
  126.                             FW_PlatformError *error);
  127.     // Ensure the capacity for text bytes is at least capacity, return the new text parameters
  128.  
  129. void FW_TextParams_SetLength(ODIText *text, 
  130.                             long length, 
  131.                             FW_ODITextParams* params, 
  132.                             FW_PlatformError *error);
  133.     // Update the length field to reflect the new number of text bytes
  134.  
  135. void FW_TextParams_SetLocale(ODIText *text,
  136.                             FW_Locale locale, 
  137.                             FW_ODITextParams* params, 
  138.                             FW_PlatformError *error);
  139.     // Modify the locale field to reflect the new locale.
  140.     // Any bytes in the string are NOT reinterpreted; it's up to the caller to only
  141.     // change the locale at acceptable times (such as when the string is empty).
  142.  
  143.  
  144. FW_EXTERN_C_END
  145.  
  146. // For CFM-68K [sfu]
  147.  
  148. #if defined(FW_ODFLIB_IMPORT)
  149. #pragma import off
  150. #elif defined(FW_ODFLIB)
  151. #pragma export off
  152. #endif
  153.  
  154. #endif
  155.  
  156.